package  io.renren.modules.generator.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import io.renren.modules.generator.dao.OrderDetailDao;
import io.renren.modules.generator.entity.OrderDetailEntity;
import io.renren.modules.generator.service.OrderDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Service("orderDetailService")
public class OrderDetailServiceImpl extends ServiceImpl<OrderDetailDao, OrderDetailEntity> implements OrderDetailService {

    @Autowired
    private  OrderDetailDao orderDetailDao;

    @Override
    public  List<OrderDetailEntity> queryPage(Map<String, Object> params) {

        return orderDetailDao.queryPage(params);
    }
    @Override
    public  int queryPageTotal(Map<String, Object> params) {

        return orderDetailDao.queryPageTotal(params);
    }

    @Override
    public List<OrderDetailEntity> queryDetailByOrderId(Integer orderId) {
        if(orderId == null ){
            return  null;
        }
        return orderDetailDao.queryDetailByOrderId(orderId);
    }

    @Override
    public void deleteByOrderId(Integer orderId) {
        HashMap<String, Object> map = new HashMap<>();
        map.put("order_id",orderId);
        this.deleteByMap(map);
    }


}
